﻿using AbpApplication.AppServices.Dto;
using AbpApplication.Dto;
using AbpApplication.Flurl;
using AbpEntityFrameworkcore.DbContext;
using AbpToDomain.CustomEntityInfo;
using AbpToDomain.EntityInfo;
using AutoMapper;
using Mesosphere.Dto;

namespace AbpApplication
{
    public class JobToDddProfile : Profile
    {

        public JobToDddProfile() 
        {

            CreateMap<MyUser, UserDto>();
            //CreateMap< List<PutOutOrder>, List<PutInOrderDto>>();
            CreateMap<PutInOrderDto, PutInOrder>();
            CreateMap<PutOutOrderDto, PutOutOrder>();
            CreateMap<View_Packing_List, PdaDto>();
            CreateMap<MaterialBase, PdaDto3>().
                ForMember(x=>x.PositionCode,opt=>opt.MapFrom(x=>x.BoxPosition.BoxPositionCode)).
                ForMember(x=>x.PartNumber,opt=>opt.MapFrom(x=>x.MaterialCode)).
                ForMember(x=>x.Qty,opt=>opt.MapFrom(x=>x.Quantity)).
                ForMember(x=>x.Id,opt=>opt.MapFrom(x=>x.Id_Materialbase));

            CreateMap<PutInOrder,MaterialBase>().
                ForMember(x => x.Batch, opt => opt.MapFrom(x => x.Batch)).
                 ForMember(x => x.Consumer_MaterialId, opt => opt.MapFrom(x => x.Consumer_MaterialId)).
                  ForMember(x => x.MaterialCode, opt => opt.MapFrom(x => x.MaterialCode)).
                   ForMember(x => x.Quantity, opt => opt.MapFrom(x => x.Quantity)).
                    ForMember(x => x.PutInDate, opt => opt.MapFrom(x => x.PutInDate)).
                     ForMember(x => x.Batch, opt => opt.MapFrom(x => x.Batch)).
                     ForMember(x => x.State, opt => opt.Ignore())
                     ;
                   
      


            CreateMap<MaterialBase, AGV_Packing_List_Verification>().
 ForMember(x => x.Qty_In_Packing, opt => opt.MapFrom(x => x.Quantity)).
 ForMember(x => x.Note, opt => opt.MapFrom(x => x.Type)).
 ForMember(x => x.Id, opt => opt.Ignore()).
 ForMember(x=>x.PartNumber,opt=>opt.MapFrom(x=>x.MaterialCode))
 ;//自定义属性映射 和忽略id映射

            CreateMap<View_ToAGV_MatList, PdaDto7>().
           ForMember(x => x.Partnumber, opt => opt.MapFrom(x => x.Partnumber)).
           ForMember(x => x.requiredQty, opt => opt.MapFrom(x => x.requiredQty)).
           ForMember(x => x.reelqty, opt => opt.MapFrom(x => x.reelqty)).
           ForMember(x => x.Bintype, opt => opt.MapFrom(x => x.Bintype));

            CreateMap<AGV_Reel_Bonding, PdaDto5>().
            ForMember(x => x.SeqID, opt => opt.MapFrom(x => x.SeqID));


            CreateMap<AGV_Reel_Bonding, PdaDto12>().
            ForMember(x => x.DocumentNo, opt => opt.MapFrom(x => x.DocumentNo)).
            ForMember(x => x.PartNumber, opt => opt.MapFrom(x => x.Partnumber)).
            ForMember(x => x.SeqID, opt => opt.MapFrom(x => x.SeqID));

                CreateMap<AGV_Reel_Bonding, MaterialBase>().
                ForMember(x => x.PutInDate, opt => opt.MapFrom(x => x.InputDate)).
                ForMember(x => x.Quantity, opt => opt.MapFrom(x => x.Qty)).
                ForMember(x => x.MaterialCode, opt => opt.MapFrom(x => x.Partnumber));

            CreateMap<AGV_Reel_Bonding, AGV_Packing_List_Verification>().
        ForMember(x => x.PartnumberLotID, opt => opt.MapFrom(x => x.PartnumberLotID)).
        ForMember(x => x.PartNumber, opt => opt.MapFrom(x => x.Partnumber)).
        ForMember(x => x.Qty_In_Packing, opt => opt.MapFrom(x => x.Qty)).
        ForMember(x => x.BinType, opt => opt.MapFrom(x => x.BinType)).
        ForMember(x => x.Id, opt => opt.Ignore());


            CreateMap<Unusual, PdaDto4>();
            CreateMap<TaskOrder, TaskOrderDto>().
            ForMember(x => x.InlethouseCode, opt => opt.MapFrom(x => x.InlethouseCode)).
            ForMember(x => x.BoxCode, opt => opt.MapFrom(x => x.Box.BoxCode));


            CreateMap<CustomOutRep, model>();
            CreateMap<PutOutOrder, ForceCloseList>();
        }
    }
}
